package demo1.service.impl;

import demo1.dao.UserDao;
import demo1.entity.User;
import demo1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao dao;
    @Override
    public boolean login(String name, String pass) {
        Assert.notNull(name,"用户名不能为空");
        User u=dao.selectByName(name);
        if(u!=null){
            return pass.equals(u.getPass());
        }
        return false;
    }

    @Override
    public void regitst(User u) {
        dao.insert(u);
    }
}
